@extends('admin.layout.layout')
@section('content')   
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">商品修改</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>                                
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-6 col-lg-offset-3">   
                                  @if (count($errors) > 0)
                                        <div class="alert alert-danger">
                                            <ul>
                                                @foreach ($errors->all() as $error)
                                                    <li>{{ $error }}</li>
                                                @endforeach
                                            </ul>
                                        </div>
                                    @endif
                                    <form role="form"  action="{{url('/admin/goods/update')}}" method="post" enctype="multipart/form-data">
                            <div class="form-group">
                               <label>选择分类</label>
                               <select name="cateid" class="form-control">
                                    @foreach($cates as $k=>$v)
                                        @if($v->id == $goods->cateid)
                                            <option value="{{$v->id}}" selected>{{$v->name}}</option>
                                        @else
                                            <option value="{{$v->id}}">{{$v->name}}</option> 
                                        @endif      
                                    @endforeach
                                </select>
                           </div>  
                            <div class="form-group">
                                <label>图书名</label>
                                <input class="form-control" type="text" name="name" value="{{ $goods->name }}">
                            </div>
                                <div class="form-group">
                                <label>状态</label>
                                <select name="state" class="form-control">
                                   
                                    <option value="1">激活</option>
                                    <option value="0"  @if($goods->state == 0) selected @endif>未激活</option>
                                    
                                </select>
                           </div> 
                             <div class="form-group">
                                <label>作者</label>
                                <input class="form-control" type="text" name="actro" value="{{  $goods->actro }}">
                            </div>
                             <div class="form-group">
                                <label>出版社</label>
                                <input class="form-control" type="text" name="cbs" value="{{ $goods->cbs }}">
                            </div>
                            <div class="form-group">
                                <label>出版时间</label>
                                <input class="form-control" type="text" name="date" value="{{ $goods->date }}">
                            </div>
                            <div class="form-group">
                                <label>价格</label>
                                <input class="form-control" type="text" name="price" value="{{ $goods->price }}">
                            </div>
                             <div class="form-group">
                                <label>库存</label>
                                <input class="form-control" type="text" name="num" value="{{ $goods->num }}">
                            </div>
                             <div class="form-group">
                                <label>图片</label>
                                <input type="file" name="pic">
                            </div>
                             <div class="form-group">
                                <label>简介</label>
                                <input class="form-control" type="text" name="introduce" value="{{ $goods->introduce }}">
                                <input type="hidden" name="id" value="{{  $goods->id }}">
                            </div>
                            
                            {{csrf_field()}}
                            <button  class="btn btn-primary" type="submit">修改商品</button>
                        </form>   
                                </div>
                                <!-- /.col-lg-6 (nested) -->
                            </div>
                            <!-- /.row (nested) -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
    @endsection